# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=mubeng
pkgver=272.164c0b1
pkgrel=1
groups=('blackarch' 'blackarch-proxy')
pkgdesc='An incredibly fast proxy checker & IP rotator with ease.'
arch=('x86_64' 'aarch64')
url='https://github.com/kitabisa/mubeng'
license=('APACHE')
makedepends=('git' 'go')
source=("git+https://github.com/kitabisa/$pkgname.git")
sha512sums=('SKIP')
_url='github.com/kitabisa/mubeng'

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  GOPATH="$srcdir" go mod download
  GOPATH="$srcdir" go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-s -w -X ktbs.dev/$pkgname/common.Version=v$pkgver" \
    -o $pkgname ./cmd/$pkgname
}

package() {
  cd $pkgname

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md \
    .github/CONTRIBUTING.md .github/CODE_OF_CONDUCT.md 
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

